/*
 * Filename:    HcpmsChunkUtil.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014-12-8
 */
package com.paic.mhis.hcpms.itextpdf.web.util;

import com.itextpdf.text.Chunk;
import com.itextpdf.text.Font;

public class HcpmsChunkUtil {
	public static Chunk createChunkText(Font font, String titil, String obj) {
		Chunk chunk = new Chunk();
		chunk.setFont(font);
		if (!"".equals(titil) && titil != null) {
			chunk.append(titil);
		}
		if (!"".equals(obj) && obj != null) {
			chunk.append(obj);
		}
		return chunk;
	}

	public static Chunk createChunkText(Font font, String text) {
		Chunk chunk = new Chunk();
		chunk.setFont(font);
		if (!"".equals(text) && text != null) {
			chunk.append(text);
		}
		return chunk;
	}

	public static Chunk createChunkTextReplace(Font font, String noticNum, String obj, String textName) {
		Chunk chunk = new Chunk();
		chunk.setFont(font);
		if ("".equals(noticNum) || noticNum == null) {
			noticNum = "";
		} else if ("".equals(textName) || textName == null) {

		} else if (!"".equals(obj) && obj != null) {
			noticNum = noticNum.replace("[" + textName + "]", obj);
		}
		chunk.append(noticNum);
		return chunk;
	}
}
